﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PocketReference
{
    class Program
    {
        static void Main(string[] args)
        {
            int target = 999;
            int re = sumDivisibleBy(3, target) + sumDivisibleBy(5, target) - sumDivisibleBy(15, target);
            Console.WriteLine( re );
            Console.ReadLine();
        }

        static int sumDivisibleBy(int n,int target) {
            int p = target / n;
            return n * (p * (p + 1)) / 2;
        }
    }
}
